package com.ruoyi.house.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.house.mapper.YjzHouseMapper;
import com.ruoyi.house.domain.YjzHouse;
import com.ruoyi.house.service.IYjzHouseService;

/**
 * 房源Service业务层处理
 *
 * @author 码道可道
 * @date 2025-07-25
 */
@Service
public class YjzHouseServiceImpl extends ServiceImpl<YjzHouseMapper, YjzHouse> implements IYjzHouseService {
    @Autowired
    private YjzHouseMapper yjzHouseMapper;

    /**
     * 查询房源
     *
     * @param id 房源主键
     * @return 房源
     */
    @Override
    public YjzHouse selectYjzHouseById(Long id) {
        return yjzHouseMapper.selectYjzHouseById(id);
    }

    /**
     * 查询房源列表
     *
     * @param yjzHouse 房源
     * @return 房源
     */
    @Override
    public List<YjzHouse> selectYjzHouseList(YjzHouse yjzHouse) {
        return yjzHouseMapper.selectYjzHouseList(yjzHouse);
    }

    /**
     * 新增房源
     *
     * @param yjzHouse 房源
     * @return 结果
     */
    @Override
    public int insertYjzHouse(YjzHouse yjzHouse) {
                yjzHouse.setCreateTime(DateUtils.getNowDate());
            return yjzHouseMapper.insertYjzHouse(yjzHouse);
    }

    /**
     * 修改房源
     *
     * @param yjzHouse 房源
     * @return 结果
     */
    @Override
    public int updateYjzHouse(YjzHouse yjzHouse) {
                yjzHouse.setUpdateTime(DateUtils.getNowDate());
        return yjzHouseMapper.updateYjzHouse(yjzHouse);
    }

    /**
     * 批量删除房源
     *
     * @param ids 需要删除的房源主键
     * @return 结果
     */
    @Override
    public int deleteYjzHouseByIds(Long[] ids) {
        return yjzHouseMapper.deleteYjzHouseByIds(ids);
    }

    /**
     * 删除房源信息
     *
     * @param id 房源主键
     * @return 结果
     */
    @Override
    public int deleteYjzHouseById(Long id) {
        return yjzHouseMapper.deleteYjzHouseById(id);
    }
}